package com.zy.rpc.common.serviceinfo;

import lombok.Data;

import java.io.Serializable;

/**
 * @atuthor zy
 * @date 2023/4/23 18:59
 */

@Data
public class ServiceInfo implements Serializable {
    private String appName;//应用名称

    private String serviceName;//服务名称

    private String address;//服务地址
    private Integer port;//服务端口


    public ServiceInfo() {

    }

    private ServiceInfo(Builder builder) {
        this.appName = builder.appName;
        this.serviceName = builder.serviceName;
        this.address = builder.address;
        this.port = builder.port;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String appName;
        private String serviceName;
        private String address;
        private Integer port;

        public Builder appName(String appName) {
            this.appName = appName;
            return this;
        }

        public Builder serviceName(String serviceName) {
            this.serviceName = serviceName;
            return this;
        }

        public Builder address(String address) {
            this.address = address;
            return this;
        }

        public Builder port(Integer port) {
            this.port = port;
            return this;
        }

        public ServiceInfo build() {
            return new ServiceInfo(this);
        }
    }

}
